package Thread;

public class Dom7 {
    public static void main(String[] args) throws InterruptedException {
        Thread t1=new Thread(()->{
            while (true){
                System.out.println("hello thread1");
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        },"T1");
        //把t1设置为后台进程
//        t1.setDaemon(true);
        t1.start();
        for (int i = 0; i < 3; i++) {
            Thread.sleep(1000);
            System.out.println("hello main");
        }
        System.out.println("main 进程结束");
    }
}
